# -*- coding: utf-8 -*-

# Define here the models for your scraped items
#
# See documentation in:
# https://doc.scrapy.org/en/latest/topics/items.html

import scrapy


class WeatherItem(scrapy.Item):
    # define the fields for your item here like:
    date = scrapy.Field()#日期
    city = scrapy.Field()
    highestTemperature = scrapy.Field()#最高气温
    lowTemperature = scrapy.Field()#最低气温
    weather = scrapy.Field()#天气
    windDirection = scrapy.Field()#风向
    windPower   = scrapy.Field()#风力
    pass


    def get_insert_sql(self):
      insert_sql = """
                 insert into weather(date, city, highestTemperature, lowTemperature, weather, windDirection, windPower)
                 VALUES (%s, %s,%s, %s, %s, %s, %s);
             """
      params = (self["date"], self['city'], self["highestTemperature"], self["lowTemperature"], self["weather"], self["windDirection"], self["windPower"])
      return insert_sql,params
